package com.wl.lib.utils

import android.widget.ImageView
import android.widget.TextView
import com.wl.lib.base.R
import com.wl.lib.http.NetworkHelper


// Created by wangliang on 2024/4/28.
object ErrorStateHelper {

    @JvmOverloads
    @JvmStatic
    fun updateErrorTextAndImage(errorIv: ImageView, errorTv: TextView
    ) {
        if (NetworkHelper.isNetworkAvailable(ApplicationHelper.getInstance())) {
            errorIv.setImageResource(R.drawable.icon_other_error)
            errorTv.text = ResUtils.getString(R.string.load_other_error)
        } else {
            errorIv.setImageResource(R.drawable.icon_no_network_error)
            errorTv.text = ResUtils.getString(R.string.load_no_network_error)
        }
    }
}